import socketserver模块
import json

sk = socketserver模块.socket()
sk.connect(('127.0.0.1', 9001))
name = 'jack'

while True:
    inp = input('>>>')
    dic = {'inp': inp, 'name': name}
    str_dic = json.dumps(dic)
    sk.send(str_dic.encode('utf-8'))
    if inp.upper() == 'Q':
        break
    msg = sk.recv(1024).decode('utf-8')
    if msg.upper() == 'Q':
        break
    print(msg)
sk.close()
